package 笔试.科大讯飞笔试.第三题矩阵相交;

import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {

        Scanner in = new Scanner(System.in);

        double p1 = in.nextDouble();
        double p2 = in.nextDouble();
        double p3 = in.nextDouble();
        double p4 = in.nextDouble();
        double p5 = in.nextDouble();
        double p6 = in.nextDouble();
        double p7 = in.nextDouble();
        double p8 = in.nextDouble();

        double[] res = new double[]{p1, p2, p3, p4, p5, p6, p7, p8};


        //直接判断不相交的情况
        if ((res[2] < res[4] && res[3] < res[5]) || (res[6] < res[0] && res[7] < res[1]))
            System.out.println(0);
        else
            System.out.println(1);

//        if ((res[0] <= res[4] && res[1] <= res[5] && res[4] <= res[2] && res[5] <= res[3]) ||
//                (res[0] <= res[6] && res[1] <= res[7] && res[6] <= res[2] && res[7] <= res[3]) ||
//                (res[4] <= res[0] && res[5] <= res[1] && res[0] <= res[6] && res[1] <= res[7]) ||
//                (res[4] <= res[2] && res[5] <= res[3] && res[2] <= res[6] && res[3] <= res[7]))
//            System.out.println(1);
//        else
//            System.out.println(0);


    }
}
